package com.taotao.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.taotao.manage.pojo.ItemDesc;
import com.taotao.web.bean.ItemVO;
import com.taotao.web.service.ItemService;


@Controller
@RequestMapping("item")
public class ItemController {
	@Autowired
	private ItemService itemService;

	@RequestMapping(value="{itemId}",method = RequestMethod.GET)
	public ModelAndView queryItemId(@PathVariable(value="itemId") Long itemId){
		//创建视图 并设置视图名称
		ModelAndView mv = new ModelAndView("item");
		//添加模型数据
		ItemVO item = this.itemService.queryById(itemId);
		mv.addObject("item", item);
		ItemDesc itemDesc = this.itemService.queryByItemDescId(itemId);
		mv.addObject("itemDesc", itemDesc);
		return mv;
		
	}
}
